package cn.edu.njnu.opengmpback.resource.dao;

import cn.edu.njnu.opengmpback.resource.entity.ModelItem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description
 * @Auther wyjq
 * @Date 2022/4/6
 **/
@Repository
public interface ModelItemDao extends MongoRepository<ModelItem, String> {
    ModelItem findByName(String name);

    Page<ModelItem> findAllByModelTypeAndNameLikeIgnoreCaseAndNormalTagsLikeIgnoreCase(String modelType, String searchText, String tagName, Pageable pageable);

    Page<ModelItem> findAllByModelTypeAndNameLikeIgnoreCaseAndNormalTagsContainingIgnoreCase(String modelType, String searchText, List<String> tagName, Pageable pageable);

    Page<ModelItem> findAllByModelTypeAndNameLikeIgnoreCaseAndProblemTagsLikeIgnoreCase(String modelType, String searchText, String tagName, Pageable pageable);

    Page<ModelItem> findAllByNameLikeIgnoreCase(String name, Pageable pageable);
}
